/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Asus_k53s
 */
@Entity
@Table(name = "candidat", catalog = "database", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Candidat.findAll", query = "SELECT c FROM Candidat c"),
    @NamedQuery(name = "Candidat.findByIdentifiant", query = "SELECT c FROM Candidat c WHERE c.identifiant = :identifiant"),
    @NamedQuery(name = "Candidat.findByNom", query = "SELECT c FROM Candidat c WHERE c.nom = :nom"),
    @NamedQuery(name = "Candidat.findByPrenom", query = "SELECT c FROM Candidat c WHERE c.prenom = :prenom"),
    @NamedQuery(name = "Candidat.findByMotDePasse", query = "SELECT c FROM Candidat c WHERE c.motDePasse = :motDePasse"),
    @NamedQuery(name = "Candidat.findByDateDeNaissance", query = "SELECT c FROM Candidat c WHERE c.dateDeNaissance = :dateDeNaissance"),
    @NamedQuery(name = "Candidat.findByEtatCivil", query = "SELECT c FROM Candidat c WHERE c.etatCivil = :etatCivil"),
    @NamedQuery(name = "Candidat.findBySexe", query = "SELECT c FROM Candidat c WHERE c.sexe = :sexe"),
    @NamedQuery(name = "Candidat.findByAdresse", query = "SELECT c FROM Candidat c WHERE c.adresse = :adresse"),
    @NamedQuery(name = "Candidat.findByTel", query = "SELECT c FROM Candidat c WHERE c.tel = :tel"),
    @NamedQuery(name = "Candidat.findByNationalite", query = "SELECT c FROM Candidat c WHERE c.nationalite = :nationalite"),
    @NamedQuery(name = "Candidat.findByEmail", query = "SELECT c FROM Candidat c WHERE c.email = :email")})
public class Candidat implements Serializable {
    @JoinTable(name = "repondre", joinColumns = {
        @JoinColumn(name = "IDENTIFIANT", referencedColumnName = "IDENTIFIANT")}, inverseJoinColumns = {
        @JoinColumn(name = "REFERENCE", referencedColumnName = "REFERENCE")})
    @ManyToMany
    private Collection<OffreDEmploi> offreDEmploiCollection;

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDENTIFIANT")
    private Integer identifiant;
    @Basic(optional = false)
    @Column(name = "ADRESSE")
    private String adresse;
    @Basic(optional = false)
    @Column(name = "DATE_DE_NAISSANCE")
    @Temporal(TemporalType.DATE)
    private Date dateDeNaissance;
    @Basic(optional = false)
    @Column(name = "EMAIL")
    private String email;
    @Basic(optional = false)
    @Column(name = "ETAT_CIVIL")
    private char etatCivil;
    @Basic(optional = false)
    @Column(name = "MOT_DE_PASSE")
    private String motDePasse;
    @Basic(optional = false)
    @Column(name = "NOM")
    private String nom;
    @Basic(optional = false)
    @Column(name = "PRENOM")
    private String prenom;
    @Basic(optional = false)
    @Column(name = "SEXE")
    private char sexe;
    @Basic(optional = false)
    @Column(name = "TEL")
    private int tel;
    @JoinColumn(name = "NATIONALITE", referencedColumnName = "PAYS")
    @ManyToOne
    private Bureau nationalite;

    public Candidat() {
    }

    public Candidat(Integer identifiant) {
        this.identifiant = identifiant;
    }

    public Candidat(Integer identifiant, String nom, String prenom, String motDePasse, Date dateDeNaissance, char etatCivil, char sexe, String adresse, int tel, String email) {
        this.identifiant = identifiant;
        this.adresse = adresse;
        this.dateDeNaissance = dateDeNaissance;
        this.email = email;
        this.etatCivil = etatCivil;
        this.motDePasse = motDePasse;
        this.nom = nom;
        this.prenom = prenom;
        this.sexe = sexe;
        this.tel = tel;
    }

    public Integer getIdentifiant() {
        return identifiant;
    }

    public void setIdentifiant(Integer identifiant) {
        this.identifiant = identifiant;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public Date getDateDeNaissance() {
        return dateDeNaissance;
    }

    public void setDateDeNaissance(Date dateDeNaissance) {
        this.dateDeNaissance = dateDeNaissance;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public char getEtatCivil() {
        return etatCivil;
    }

    public void setEtatCivil(char etatCivil) {
        this.etatCivil = etatCivil;
    }

    public String getMotDePasse() {
        return motDePasse;
    }

    public void setMotDePasse(String motDePasse) {
        this.motDePasse = motDePasse;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public char getSexe() {
        return sexe;
    }

    public void setSexe(char sexe) {
        this.sexe = sexe;
    }

    public int getTel() {
        return tel;
    }

    public void setTel(int tel) {
        this.tel = tel;
    }

    public Bureau getNationalite() {
        return nationalite;
    }

    public void setNationalite(Bureau nationalite) {
        this.nationalite = nationalite;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (identifiant != null ? identifiant.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Candidat)) {
            return false;
        }
        Candidat other = (Candidat) object;
        if ((this.identifiant == null && other.identifiant != null) || (this.identifiant != null && !this.identifiant.equals(other.identifiant))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Candidat[ identifiant=" + identifiant + " ]";
    }

    @XmlTransient
    public Collection<OffreDEmploi> getOffreDEmploiCollection() {
        return offreDEmploiCollection;
    }

    public void setOffreDEmploiCollection(Collection<OffreDEmploi> offreDEmploiCollection) {
        this.offreDEmploiCollection = offreDEmploiCollection;
    }
}
